//
//  LGSDocument.h
//  LogicSim
//
//  Created by Jeremy Pereira on 04/04/2012.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

/*!
 *  @file LGSDocument.h
 *
 *  @brief Document controller for the LogicSim application.
 *
 *  @author Jeremy Pereira
 */

#import <Cocoa/Cocoa.h>
#import "LGSNodeTypeSelectorDelegate.h"
#import "LGSConnectNodeSelectorDelegate.h"
#import "LGSInputMappingSelectorDelegate.h"

@class LGSSelectNodeTypeSheetController;
@class LGSConnectNodeSheetController;
@class LGSInputMappingSheetController;
@class LGSNodeViewController;
@class LGSNode;

/*!
 *  @brief Document controller for the LogicSim application.
 *  @todo When the datasource gets too complex, separate into a separate class
 *  @todo Reimplement node connecting
 *  @todo Context menu for the outline view
 *  @todo Copy existing node
 *  @todo Fix connecting at top level
 *  @todo Be able to run the network
 */
@interface LGSDocument : NSDocument 
						<NSOutlineViewDataSource, 
						 LGSNodeTypeSelectorDelegate,
                         LGSConnectNodeSelectorDelegate,
						 LGSInputMappingSelectorDelegate>

/*!
 *  @brief The outline view of the componets in the diagram
 */
@property (strong) IBOutlet NSOutlineView* componentView;
/*!
 *  @brief The controller of the sheet that selects nodes for us.
 */
@property (strong) IBOutlet LGSSelectNodeTypeSheetController* selectNodeSheetController;
/*!
 *  @brief The controller of the sheet that allows us to connect two nodes.
 */
@property (strong) IBOutlet LGSConnectNodeSheetController* connectNodeSheetController;
/*!
 *  @brief The controller that controls the sheet to get an input mapping.
 */
@property (strong) IBOutlet LGSInputMappingSheetController* inputMappingSheetController;

/*!
 *  @brief The object that controls the right pane i.e. the node view.
 */
@property (strong) IBOutlet LGSNodeViewController* nodeViewController;

/*!
 *  @brief add a node to the diagram.
 *  @param sender Sender of the action.
 *  @return Nothing
 */
-(IBAction) addNode: (id) sender;

/*!
 *  @brief Copy a component.
 *
 *  @param sender Sender of the action.
 *  @return nothing
 */
-(IBAction) copyNode: (id) sender;
/*!
 *  @brief remove a node to the diagram.
 *  @param sender Sender of the action.
 *  @return Nothing
 */
-(IBAction) removeNode: (id) sender;

/*!
 *  Connect two nodes in the diagram
 *  @param sender Sender of the action.
 *  @return Nothing
 */
-(IBAction) connectNodes: (id) sender;

/*!
 *  @brief Sent when the user requests to make an input mapping.
 *
 *  @param sender Sender of the message.
 *  @return nothing
 */
-(IBAction) makeInputMapping: (id) sender;

/*!
 *  @brief Sent when the selected node in the left pane changes.
 */
-(IBAction) selectedNodeChanged:(id)sender;

/*!
 *  @brief Invoked when a node has been updated such that the display needs 
 *  updating and the file needs saving.
 *  @param updatedNode Node that has been changed.
 */
-(void) updateNode: (LGSNode*) updatedNode;

@end
